﻿@model PagedInfo<ViewContentAndCate>
@inject AppLinkService appLinkService
@inject ContentService articleService
@inject ContentCateService contentCateService
@{
    ContentCate cateInfo = ViewBag.cateInfo as ContentCate;
    ViewData["Title"] = cateInfo.Name;
    ViewData["SiteName"] = await SystemConfig.GetByFieldNameAsync("SiteName");
    ViewData["Description"] = await SystemConfig.GetByFieldNameAsync("Description");
    Layout = null;
    int[] sonCids = await contentCateService.CatSonListIdsAsync(cateInfo.Id);
}
<!doctype html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="@ViewData["Description"]">
    <meta name="author" content="Cdeng">
    <title>@ViewData["Title"]</title>
    <link href="~/lib/layui/css/layui.css" rel="stylesheet">
    <link href="~/home/css/main.css" rel="stylesheet">
    <link href="~/home/css/list.css" rel="stylesheet">
</head>
<body>
    @if (ViewBag.cateInfo.BannerHeader != null && ViewBag.cateInfo.BannerHeader != "")
    {
        <style>
            body { width: 100%; min-height: 100%; background: url("@ViewBag.cateInfo.BannerHeader") top center no-repeat #fff; }
            .cxuu-list-margintop { margin-top: @ViewBag.cateInfo.BannerLit; }
        </style>
    }

    <div class="layui-container cxuu-list-margintop">
        <ul class="layui-nav" lay-filter="">
            <li class="layui-nav-item"><a asp-area="" asp-controller="Home" asp-action="Index" style="font-size:22px;">琪耀</a></li>

            @foreach (var item in await contentCateService.CateListByIdAsync(sonCids))
            {
                <li class="layui-nav-item">
                    <a asp-area="Home" asp-controller="List" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@item.Name</a>
                </li>
            }

            <li class="layui-layout-right layui-hide-xs" style="padding-top:10px;">
                <form asp-controller="Search" asp-action="Index" method="get">
                    <div class="layui-col-md7">
                        <input type="text" name="keyword" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
                    </div>
                    <div class="layui-col-md5">
                        <button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="submittitle"><i class="layui-icon">&#xe615;</i> Search </button>
                    </div>
                </form>
            </li>

        </ul>
    </div>
    <!--路径 开始-->
    <div class="layui-container" style="margin-top:10px;">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-panel" style="text-align:left;padding:10px;">
                    <span class="layui-breadcrumb">
                        <a href="/">Home</a>
                        <a><cite>@ViewBag.cateInfo.Name</cite></a>
                    </span>
                </div>
            </div>
        </div>
    </div>
    <!--路径 结束-->
    <!--轮播部分 开始-->
    <div class="layui-container">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-xs12 layui-col-md6">
                <div class="layui-carousel cxuu-carousel" id="lunbo" lay-filter="lunbo">
                    <div carousel-item="">
                        @foreach (var item in await articleService.QyList(new() { Cids = sonCids, Limit = 5, CacheName = "imgcarouselx" + ViewBag.sonCids, CacheTime = 600, Att = 3, ImgBl = true }))
                        {
                            <div>
                                <div class="image"><a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link"><img src="@item.Img" width="660" height="370" /></a></div>
                                <div class="title"><a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 26)</a></div>
                            </div>

                        }
                    </div>
                </div>
            </div>
            <div class="layui-col-xs12 layui-col-md6">
                <div class="layui-panel cxuu-index-top-center">
                    <div class="sec">
                        @foreach (var item in await articleService.QyList(new() { Cids = sonCids, Limit = 1, Att = 2, CacheName = "calist-sec" + ViewBag.sonCids }))
                        {
                            <a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 16)</a>
                        }
                    </div>
                    <ul>
                        @foreach (var item in await articleService.QyList(new() { Cids = sonCids, Limit = 10, CacheName = "calist-right2" + ViewBag.sonCids }))
                        {
                            <li><span class="layui-badge-dot layui-bg-blue cxuu-dot-4x4"></span> <span class="cxuu-list-time">@item.Time.ToString("yyyy-MM-dd")</span><a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 18)</a></li>
                        }
                    </ul>
                </div>
            </div>

        </div>
    </div>
    <!--轮播部分 结束-->

    <div class="layui-container" style="margin-top:10px;margin-bottom:10px;height:150px;">
        <div class="layui-hide-xs layui-col-md12">
            @foreach (var item in await appLinkService.GetListAsync(new() { Cid = 3, PageSize = 1 }))
            {
                <div> <a href="@item.Url" class="nav-link"><img src="@item.Img" width="1330" height="150" /></a></div>
            }
        </div>
    </div>


    <!--主体-->
    <div class="layui-container">
        <div class="layui-row layui-col-space10">
            @foreach (var cates in await contentCateService.CateListByIdAsync(sonCids))
            {
                <div class="layui-col-xs12 layui-col-md4">
                    <div class="layui-card">
                        <div class="layui-card-header cxuu-card-head"> <i class="layui-icon @cates.Ico"></i> <a asp-area="Home" asp-controller="List" asp-action="Index" asp-route-id="@cates.Id">@cates.Name</a></div>
                        <div class="layui-card-body  cxuu-list">
                            <ul>
                                @foreach (var item in await articleService.QyList(new() { Cids = new int[] { cates.Id }, Limit = 10, CacheName = "cates_" + cates.Id }))
                                {
                                    <li><span class="layui-badge-dot layui-bg-blue cxuu-dot-4x4"></span> <span class="cxuu-list-time">@item.Time.ToString("MM-dd")</span><a asp-area="Home" asp-controller="Info" asp-action="Index" asp-route-id="@item.Id" class="nav-link">@StringUtility.Trim(item.Title, 16)</a></li>
                                }
                            </ul>
                        </div>
                    </div>
                </div>
            }
        </div>
    </div>

    <!--主体 E-->
    <partial name="_Footer" />
    <script src="~/lib/layui/layui.js"></script>
    <script>
        layui.use(function () {
            var laypage = layui.laypage
                , layer = layui.layer
                , element = layui.element
                , carousel = layui.carousel;
            carousel.render({
                elem: '#lunbo'
                , arrow: 'always'
                , width: '100%'
                , height: '400px'
                , indicator: 'inside'
            });
            laypage.render({
                elem: 'laypage'
                , count: '@Model.TotalNum'
                , limit: '@ViewBag.cateInfo.Num'
                , groups: '@Model.TotalPage'
                , theme: '#1E9FFF'
                , curr: '@Model.PageSize' //获取起始页
                //,hash: '/' //自定义hash值
                , prev: "上一页"
                , next: "下一页"
                , jump: function (obj, first) {
                    if (!first) {
                        location.href = '/Home/List/Index/@ViewBag.cateInfo.Id?page=' + obj.curr;
                    }
                }
            });
        });
    </script>
</body>
</html>